/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rdb.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Bich Tran Van
 */
@Entity
@Table(name = "student_exams")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "StudentExams.findAll", query = "SELECT s FROM StudentExams s"),
    @NamedQuery(name = "StudentExams.findById", query = "SELECT s FROM StudentExams s WHERE s.id = :id"),
    @NamedQuery(name = "StudentExams.findByMark", query = "SELECT s FROM StudentExams s WHERE s.mark = :mark"),
    @NamedQuery(name = "StudentExams.findByRemark", query = "SELECT s FROM StudentExams s WHERE s.remark = :remark"),
    @NamedQuery(name = "StudentExams.findByStatus", query = "SELECT s FROM StudentExams s WHERE s.status = :status")})
public class StudentExams implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "Id")
    private Integer id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "mark")
    private Double mark;
    @Column(name = "remark")
    private Double remark;
    @Column(name = "status")
    private Boolean status;
    @JoinColumn(name = "studentId", referencedColumnName = "Id")
    @ManyToOne
    private Students studentId;
    @JoinColumn(name = "examId", referencedColumnName = "Id")
    @ManyToOne
    private Exams examId;
    @OneToMany(mappedBy = "id")
    private List<Registers> registersList;

    
    
    public StudentExams() {
    }

    public StudentExams(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Double getMark() {
        return mark;
    }

    public void setMark(Double mark) {
        this.mark = mark;
    }

    public Double getRemark() {
        return remark;
    }

    public void setRemark(Double remark) {
        this.remark = remark;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public Students getStudentId() {
        return studentId;
    }

    public void setStudentId(Students studentId) {
        this.studentId = studentId;
    }

    public Exams getExamId() {
        return examId;
    }

    public void setExamId(Exams examId) {
        this.examId = examId;
    }

    @XmlTransient
    public List<Registers> getRegistersList() {
        return registersList;
    }

    public void setRegistersList(List<Registers> registersList) {
        this.registersList = registersList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StudentExams)) {
            return false;
        }
        StudentExams other = (StudentExams) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.rdb.entities.StudentExams[ id=" + id + " ]";
    }
    
}
